﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.Common;

namespace Golf.WebUI.AdminShow.CommoditiesMmanagement
{
    public partial class Golf_Product_shouming : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                switch (Request.Params["action"])
                {
                    case "modify_jieshao"://修改
                        modify_jieshao();
                        break;
                }
            }
        }

        private void modify_jieshao()
        {
            if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
            {
                lblId.Text = Request.Params["id"];
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            if (this.FCKeditor_Pro_Usage.Value.Trim().Length == 0)
            {
                strErr += "产品使用方法不能为空！\\n";
            }
            if (this.FCKeditor_Pro_Introduction.Value.Trim().Length == 0)
            {
                strErr += "产品介绍不能为空！\\n";
            }
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string Pro_Usage = this.FCKeditor_Pro_Usage.Value;
            string Pro_Introduction = this.FCKeditor_Pro_Introduction.Value;
            Golf.BLL.Golf_Product bll = new Golf.BLL.Golf_Product();
            int Id = int.Parse(this.lblId.Text);
            Golf.Model.Golf_Product model = bll.GetModel(Id);
            model.Pro_Usage = Pro_Usage;
            model.Pro_Introduction = Pro_Introduction;
            if (bll.Update(model))
            {
                Page.ClientScript.RegisterStartupScript(typeof(Page), "", "handler('修改成功！');", true);
            }
            else
            {

                Page.ClientScript.RegisterStartupScript(typeof(Page), "", "ymPrompt.errorInfo('修改失败');", true);
            }

        }

        public void btnCancle_Click(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(typeof(Page), "", "handler('请点击确定取消当前操作！');", true);
        }
    }
}
